home *** CD-ROM | disk | FTP | other *** search
- ' GETLEFT.BAS
- ' This program demonstrates the LEFT$ function.
-
- CLS
-
- alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ' declare test string
-
- PRINT "How many characters (from left to right) in the following"
- PRINT "string would you like to display?"
- PRINT
- PRINT alphabet$ ' display test string
- PRINT
-
- ' get from user number of leftmost characters to be displayed
- DO ' loop until number is in proper range (1 through 26)
- INPUT " Number (1-26): ", leftNum%
- LOOP WHILE (leftNum% < 1) OR (leftNum% > 26)
-
- PRINT
- leftChar$ = LEFT$(alphabet$, leftNum%) ' display characters
- PRINT "You specified"; LEN(leftChar$); "characters: "; leftChar$
-
-